using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations.Schema;
using SalesPages.DomainModel;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class EfcnEtagMap : EntityTypeConfiguration<EfcnEtag>
    {
        public EfcnEtagMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.etag)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.chdesc)
                .HasMaxLength(5000);

            this.Property(t => t.etagdesc)
                .HasMaxLength(5000);

            // Table & Column Mappings
            this.ToTable("EfcnEtag");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.etag).HasColumnName("etag");
            this.Property(t => t.chdesc).HasColumnName("chdesc");
            this.Property(t => t.etagdesc).HasColumnName("etagdesc");
        }
    }
}
